<template>
    <div class="noticeDetail">
        <div 
            class="content" 
            v-if="Object.keys(noticeInfo).length>0" 
            v-html="noticeInfo.content"
        ></div>
    </div>
</template>

<script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app";
import { ref } from "vue";
import { objectAny } from "../../options/base";
import { getNoticeList } from "../../utils/common/notice_api";
import { goToBack, showModal } from "../../utils/utils";

    const noticeInfo=ref<objectAny>({})
    onLoad(async (options)=>{
        const id=options.id || '';
        const title=options.title || '';
        if(id=='' || title==''){
            await showModal({
                title:`异常提示`,
                content:`加载错误请重新进入`,
                showCancel:false
            })
            return goToBack();
        }
        uni.setNavigationBarTitle({
            title
        });

        const noticeList=await getNoticeList(false,id);
        if(noticeList.length>0){
            noticeInfo.value=noticeList[0]
        }
    })

</script>

<style lang="stylus" scoped>
.noticeDetail
    .content
        padding: 25rpx
        box-sizing: border-box
</style>